<template>
  <el-card class="box-card">
    <div slot="header" class="clearfix">
      <shopee-table stripe :data="taskInstanceDetailsData">

        <shopee-table-column prop="git_url" label="git地址" :width="300">
           <template slot-scope="props">
            <el-link target="_blank" :href="props.row.git_url" type="primary">{{props.row.git_url}}</el-link>
           </template>
        </shopee-table-column>

        <shopee-table-column prop="type" label="类型" :width="80">
        </shopee-table-column>

          <shopee-table-column prop="env" label="环境"  :width="80">
        </shopee-table-column>
        <shopee-table-column  prop="update_time" label="部署时间"  >
        </shopee-table-column>


        <shopee-table-column prop="commit" label="当前部署"  >
        </shopee-table-column>

        <shopee-table-column prop="new_deploy_commit" label="new commit(和已部署版本比)"  :width="80">
      </shopee-table-column>
         <shopee-table-column prop="new_commit_num" label="new commit(和release比)"  :width="80">
        </shopee-table-column>
        <shopee-table-column  label="commit key"  :width="150">
          <template slot-scope="props">
                  <p v-for="item in props.row.new_commit_keys">
                    <el-link target="_blank" :href="'https://jira.shopee.io/browse/'+item" type="primary">{{item}}</el-link>
                  </p>
            </template>
        </shopee-table-column>

        <shopee-table-column   label="部署链接"  :width="100">
           <template slot-scope="props">
            <el-link target="_blank" :href="props.row.deploy_url" type="primary">查看部署</el-link>
           </template>
        </shopee-table-column>

      </shopee-table>
    </div>
  </el-card>
</template>

  <script>
    import {api, getRequest, postRequest} from "@/api/commit";

    export default {
      name : "TaskInstanceDeployView",
      data() {
        return {
          taskInstanceDetailsData: [],
        }
      },
      methods: {
        init_data() {
          let params ={
            "id": this.$route.query.id
          }
          getRequest(api['task_instance_deploy_list'],params).then((res) => {
            res = res.resultReturn
            this.taskInstanceDetailsData= res.data
          }, (error) => {
            console.info(error)
          })
        }
      },
      mounted () {
        this.init_data()
      }
    }
  </script>
